import { createApp } from 'vue'
import App from './App.vue'
// 引入element-plus样式
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css'
// 引入全局参数
import mhconfig from './mhblogconfig'
// 引入路由
import router from "./router";
import ElementPlusIconsVue from '@element-plus/icons-vue'

// 中文
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'

// 引入阿里巴巴字体
import './assets/font/font.css'

import Vue3OrgTree from  'vue3-tree-org'
import 'vue3-tree-org/lib/vue3-tree-org.css'


// 引入markdown编辑组件
// import VMdEdittor from '@kangc/v-md-editor'
// import '@kangc/v-md-editor/lib/style/base-editor.css'
// import githubTheme from '@kangc/v-md-editor/lib/theme/github.js'
// import '@kangc/v-md-editor/lib/theme/style/github.css'
// import hljs from 'highlight.js'
// VMdEdittor.use(githubTheme,{
//     Hljs:hljs
// })

// 解决element table ResizeObserver 报错 start
const debounce = (fn,delay) => {
    let timer
    return (...args) => {
        if (timer){
            clearTimeout(timer)
        }
        timer = setTimeout(() => {
            fn(...args)
        },delay)
    }
}
const _ResizeObserver = window.ResizeObserver;
window.ResizeObserver = class ResizeObserver extends _ResizeObserver{
    constructor(callback) {
        callback = debounce(callback,200)
        super(callback);
    }
}
// end


const app = createApp(App)
app.use(Vue3OrgTree)
app.use(ElementPlus, {
    locale: zhCn,
})
app.use(router)
// app.use(MarkDownEditor)
// app.use(VMdEdittor)
app.component(ElementPlusIconsVue)
// 注入全局参数
app.config.globalProperties.$mhconfig = mhconfig
// 添加自定义axios工具
// import axiosUtil from "@/axiosUtil";
// app.config.globalProperties.$axiosUtil = axiosUtil
app.mount('#app')



